<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head><!-- start favicons snippet, use https://realfavicongenerator.net/ --><link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"><link rel="manifest" href="/assets/site.webmanifest"><link rel="mask-icon" href="/assets/safari-pinned-tab.svg" color="#fc4d50"><link rel="shortcut icon" href="/assets/favicon.ico"><meta name="msapplication-TileColor" content="#ffc40d"><meta name="msapplication-config" content="/assets/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- end favicons snippet -->
<title>SampleStream (ExoPlayer library)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="SampleStream (ExoPlayer library)";
        }
    }
    catch(err) {
    }
//-->
var data = {"i0":6,"i1":6,"i2":6,"i3":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">com.google.android.exoplayer2.source</a></div>
<h2 title="Interface SampleStream" class="title">Interface SampleStream</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="chunk/ChunkSampleStream.html" title="class in com.google.android.exoplayer2.source.chunk">ChunkSampleStream</a></code>, <code><a href="chunk/ChunkSampleStream.EmbeddedSampleStream.html" title="class in com.google.android.exoplayer2.source.chunk">ChunkSampleStream.EmbeddedSampleStream</a></code>, <code><a href="EmptySampleStream.html" title="class in com.google.android.exoplayer2.source">EmptySampleStream</a></code>, <code><a href="../testutil/FakeSampleStream.html" title="class in com.google.android.exoplayer2.testutil">FakeSampleStream</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">SampleStream</span></pre>
<div class="block">A stream of media samples (and associated format information).</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!--   -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SampleStream.ReadDataResult.html" title="annotation in com.google.android.exoplayer2.source">SampleStream.ReadDataResult</a></span></code></th>
<td class="colLast">
<div class="block">Return values of <a href="#readData(com.google.android.exoplayer2.FormatHolder,com.google.android.exoplayer2.decoder.DecoderInputBuffer,int)"><code>readData(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, int)</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SampleStream.ReadFlags.html" title="annotation in com.google.android.exoplayer2.source">SampleStream.ReadFlags</a></span></code></th>
<td class="colLast">
<div class="block">Flags that can be specified when calling <a href="#readData(com.google.android.exoplayer2.FormatHolder,com.google.android.exoplayer2.decoder.DecoderInputBuffer,int)"><code>readData(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, int)</code></a>.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#FLAG_OMIT_SAMPLE_DATA">FLAG_OMIT_SAMPLE_DATA</a></span></code></th>
<td class="colLast">
<div class="block">Specifies that <a href="../decoder/DecoderInputBuffer.html#data"><code>DecoderInputBuffer.data</code></a>, <a href="../decoder/DecoderInputBuffer.html#supplementalData"><code>DecoderInputBuffer.supplementalData</code></a> and
 <a href="../decoder/DecoderInputBuffer.html#cryptoInfo"><code>DecoderInputBuffer.cryptoInfo</code></a> should not be populated when reading a sample buffer.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#FLAG_PEEK">FLAG_PEEK</a></span></code></th>
<td class="colLast">
<div class="block">Specifies that the read position should not be advanced if a sample buffer is read.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#FLAG_REQUIRE_FORMAT">FLAG_REQUIRE_FORMAT</a></span></code></th>
<td class="colLast">
<div class="block">Specifies that if a sample buffer would normally be read next, the format of the stream should
 be read instead.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isReady()">isReady</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns whether data is available to be read.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#maybeThrowError()">maybeThrowError</a></span>()</code></th>
<td class="colLast">
<div class="block">Throws an error that's preventing data from being read.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#readData(com.google.android.exoplayer2.FormatHolder,com.google.android.exoplayer2.decoder.DecoderInputBuffer,int)">readData</a></span>&#8203;(<a href="../FormatHolder.html" title="class in com.google.android.exoplayer2">FormatHolder</a>&nbsp;formatHolder,
        <a href="../decoder/DecoderInputBuffer.html" title="class in com.google.android.exoplayer2.decoder">DecoderInputBuffer</a>&nbsp;buffer,
        int&nbsp;readFlags)</code></th>
<td class="colLast">
<div class="block">Attempts to read from the stream.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#skipData(long)">skipData</a></span>&#8203;(long&nbsp;positionUs)</code></th>
<td class="colLast">
<div class="block">Attempts to skip to the keyframe before the specified position, or to the end of the stream if
 <code>positionUs</code> is beyond it.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a id="FLAG_PEEK">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FLAG_PEEK</h4>
<pre>static final&nbsp;int FLAG_PEEK</pre>
<div class="block">Specifies that the read position should not be advanced if a sample buffer is read.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.source.SampleStream.FLAG_PEEK">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="FLAG_REQUIRE_FORMAT">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FLAG_REQUIRE_FORMAT</h4>
<pre>static final&nbsp;int FLAG_REQUIRE_FORMAT</pre>
<div class="block">Specifies that if a sample buffer would normally be read next, the format of the stream should
 be read instead. In detail, the effect of this flag is as follows:

 <ul>
   <li>If a sample buffer would be read were the flag not set, then the stream format will be
       read instead.
   <li>If nothing would be read were the flag not set, then the stream format will be read if
       it's known. If the stream format is not known then behavior is unchanged.
   <li>If an end of stream buffer would be read were the flag not set, then behavior is
       unchanged.
 </ul></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.source.SampleStream.FLAG_REQUIRE_FORMAT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="FLAG_OMIT_SAMPLE_DATA">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>FLAG_OMIT_SAMPLE_DATA</h4>
<pre>static final&nbsp;int FLAG_OMIT_SAMPLE_DATA</pre>
<div class="block">Specifies that <a href="../decoder/DecoderInputBuffer.html#data"><code>DecoderInputBuffer.data</code></a>, <a href="../decoder/DecoderInputBuffer.html#supplementalData"><code>DecoderInputBuffer.supplementalData</code></a> and
 <a href="../decoder/DecoderInputBuffer.html#cryptoInfo"><code>DecoderInputBuffer.cryptoInfo</code></a> should not be populated when reading a sample buffer.

 <p>This flag is useful for efficiently reading or (when combined with <a href="#FLAG_PEEK"><code>FLAG_PEEK</code></a>)
 peeking sample metadata. It can also be used for efficiency by a caller wishing to skip a
 sample buffer.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../constant-values.html#com.google.android.exoplayer2.source.SampleStream.FLAG_OMIT_SAMPLE_DATA">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a id="isReady()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isReady</h4>
<pre class="methodSignature">boolean&nbsp;isReady()</pre>
<div class="block">Returns whether data is available to be read.

 <p>Note: If the stream has ended then a buffer with the end of stream flag can always be read
 from <a href="#readData(com.google.android.exoplayer2.FormatHolder,com.google.android.exoplayer2.decoder.DecoderInputBuffer,int)"><code>readData(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, int)</code></a>. Hence an ended stream is always ready.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Whether data is available to be read.</dd>
</dl>
</li>
</ul>
<a id="maybeThrowError()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maybeThrowError</h4>
<pre class="methodSignature">void&nbsp;maybeThrowError()
              throws <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></pre>
<div class="block">Throws an error that's preventing data from being read. Does nothing if no such error exists.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></code> - The underlying error.</dd>
</dl>
</li>
</ul>
<a id="readData(com.google.android.exoplayer2.FormatHolder,com.google.android.exoplayer2.decoder.DecoderInputBuffer,int)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readData</h4>
<pre class="methodSignature"><a href="SampleStream.ReadDataResult.html" title="annotation in com.google.android.exoplayer2.source">@ReadDataResult</a>
int&nbsp;readData&#8203;(<a href="../FormatHolder.html" title="class in com.google.android.exoplayer2">FormatHolder</a>&nbsp;formatHolder,
             <a href="../decoder/DecoderInputBuffer.html" title="class in com.google.android.exoplayer2.decoder">DecoderInputBuffer</a>&nbsp;buffer,
             <a href="SampleStream.ReadFlags.html" title="annotation in com.google.android.exoplayer2.source">@ReadFlags</a>
             int&nbsp;readFlags)</pre>
<div class="block">Attempts to read from the stream.

 <p>If the stream has ended then <a href="../C.html#BUFFER_FLAG_END_OF_STREAM"><code>C.BUFFER_FLAG_END_OF_STREAM</code></a> flag is set on <code>
 buffer</code> and <a href="../C.html#RESULT_BUFFER_READ"><code>C.RESULT_BUFFER_READ</code></a> is returned. Else if no data is available then <a href="../C.html#RESULT_NOTHING_READ"><code>C.RESULT_NOTHING_READ</code></a> is returned. Else if the format of the media is changing or if <code>
 formatRequired</code> is set then <code>formatHolder</code> is populated and <a href="../C.html#RESULT_FORMAT_READ"><code>C.RESULT_FORMAT_READ</code></a>
 is returned. Else <code>buffer</code> is populated and <a href="../C.html#RESULT_BUFFER_READ"><code>C.RESULT_BUFFER_READ</code></a> is returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>formatHolder</code> - A <a href="../FormatHolder.html" title="class in com.google.android.exoplayer2"><code>FormatHolder</code></a> to populate in the case of reading a format.</dd>
<dd><code>buffer</code> - A <a href="../decoder/DecoderInputBuffer.html" title="class in com.google.android.exoplayer2.decoder"><code>DecoderInputBuffer</code></a> to populate in the case of reading a sample or the
     end of the stream. If the end of the stream has been reached, the <a href="../C.html#BUFFER_FLAG_END_OF_STREAM"><code>C.BUFFER_FLAG_END_OF_STREAM</code></a> flag will be set on the buffer.</dd>
<dd><code>readFlags</code> - Flags controlling the behavior of this read operation.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <a href="SampleStream.ReadDataResult.html" title="annotation in com.google.android.exoplayer2.source"><code>result</code></a> of the read operation.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../decoder/DecoderInputBuffer.InsufficientCapacityException.html" title="class in com.google.android.exoplayer2.decoder">DecoderInputBuffer.InsufficientCapacityException</a></code> - If the <code>buffer</code> has insufficient capacity to hold
     the data of a sample being read. The buffer <a href="../decoder/DecoderInputBuffer.html#timeUs"><code>timestamp</code></a> and
     flags are populated if this exception is thrown, but the read position is not advanced.</dd>
</dl>
</li>
</ul>
<a id="skipData(long)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>skipData</h4>
<pre class="methodSignature">int&nbsp;skipData&#8203;(long&nbsp;positionUs)</pre>
<div class="block">Attempts to skip to the keyframe before the specified position, or to the end of the stream if
 <code>positionUs</code> is beyond it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>positionUs</code> - The specified time.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The number of samples that were skipped.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>
